
# 4. dictA = {"name":"王老师", "height":165, "weight":90, "hobby":"打豆豆","sex":"女"}
dictA = {"name":"王老师", "height":165, "weight":90, "hobby":"打豆豆","sex":"女"}
# 打印王老师身高是多少
print("王老师身高:",dictA["height"])
# 修改 键"hobby" 为 "看电影"
dictA["hobby"]="看电影"
print(dictA)
# 添加 键"tel" ,值 123456789
dictA["tel"]="123456789"
print(dictA)
# 删除 键为 "sex"的键值数据
del dictA["sex"]
print(dictA)
# 5. dictB = {"姓名":"柳岩","年龄":25,"爱好":"跳舞"}
dictB = {"姓名":"柳岩","年龄":25,"爱好":"跳舞"}
# 打印出 "年龄" 的值
print("年龄:",dictB["年龄"])
# 打印出 "爱好" 是什么
print("爱好:" ,dictB["爱好"])
# 修改 "年龄" 的值 为 28
dictB["年龄"]=28
print(dictB)
# 添加 "电话" 为 123456789
dictB["电话"]=123456789
print(dictB)
# 添加 "身高" 为 178
dictB["身高"]=178
print(dictB)